package com.aspose.cells;

import java.util.ArrayList;

class zqh {
   zqi a = null;
   ArrayList b = new ArrayList();
   private static final com.aspose.cells.b.c.a.za c = new com.aspose.cells.b.c.a.za(new String[]{"bottomLeft", "bottomRight", "topLeft", "topRight", "frozen", "frozensplit"});

   static byte a(String var0) {
      switch(c.a(var0)) {
      case 0:
         return 2;
      case 1:
         return 0;
      case 2:
         return 3;
      case 3:
         return 1;
      default:
         return 3;
      }
   }

   static String a(byte var0) {
      switch(var0) {
      case 0:
         return "bottomRight";
      case 1:
         return "topRight";
      case 2:
         return "bottomLeft";
      case 3:
         return "topLeft";
      default:
         return "topLeft";
      }
   }

   void a(Worksheet var1) {
      byte var2 = 0;
      byte var3 = 0;
      PaneCollection var4 = null;
      if (this.a != null) {
         boolean var5 = false;
         switch(c.a(this.a.a.toLowerCase())) {
         case 4:
         case 5:
            var5 = true;
         }

         if (this.a.d != null) {
            var4 = var1.b();
            var1.a(var5);
            int[] var6 = new int[]{var2};
            int[] var7 = new int[]{var3};
            CellsHelper.a(this.a.d, var6, var7);
            int var10 = var6[0];
            int var11 = var7[0];
            var4.a(var10);
            var4.b(var11);
         } else if (!var5 && (this.a.b > 0.0D || this.a.c > 0.0D)) {
            var4 = var1.b();
            if (this.a.b > 0.0D) {
               var4.b(8);
            }

            if (this.a.c > 0.0D) {
               var4.a((int)15);
            }

            var4.a = true;
         }
      }

      zbci var16;
      if (var4 != null) {
         var4.d((int)this.a.b);
         var4.c((int)this.a.c);
         var4.f();
         var4.a(a(this.a.e));
         if (this.b != null) {
            for(int var12 = 0; var12 < this.b.size(); ++var12) {
               zqj var13 = (zqj)this.b.get(var12);
               var16 = var1.s().a(a(var13.a) & 255);
               if (var16 != null) {
                  if (var12 == 0 && var4 != null && this.a != null && this.a.e == null) {
                     var4.a(var16.a());
                  }

                  this.a(var13, var16);
               }
            }
         }
      } else if (this.b != null) {
         zbcj var15 = new zbcj(var1);
         var1.a(var15);
         boolean var14 = false;

         for(int var17 = 0; var17 < this.b.size(); ++var17) {
            zqj var8 = (zqj)this.b.get(var17);
            if ("topLeft".equals(var8.a)) {
               zbci var9 = new zbci(a(var8.a) & 255);
               var14 = true;
               com.aspose.cells.b.a.a.ze.a(var15, (Object)var9);
               this.a(var8, var9);
            }
         }

         if (!var14) {
            var16 = new zbci(a("topLeft") & 255);
            var16.a(0, 0);
            com.aspose.cells.b.a.a.ze.a(var15, (Object)var16);
         }
      }

   }

   private void a(zqj var1, zbci var2) {
      var2.b().clear();
      boolean var3 = false;
      boolean var4 = false;
      String var5 = var1.d;
      if (var5 != null && var5.length() > 0) {
         int var11 = 0;
         int var10 = 0;
         if (var1.b != null) {
            int[] var12 = new int[]{var10};
            int[] var7 = new int[]{var11};
            CellsHelper.a(var1.b, var12, var7);
            var10 = var12[0];
            var11 = var7[0];
         }

         var2.a(var10);
         var2.b(var11);
         var2.c(var1.c);
         String[] var13 = com.aspose.cells.b.a.zv.d(var5, ' ');

         for(int var14 = 0; var14 < var13.length; ++var14) {
            String var8 = var13[var14].trim();
            if (var8.length() > 0) {
               CellArea var9 = (CellArea)CellArea.a(var8, true);
               com.aspose.cells.b.a.a.ze.a(var2.b(), (Object)var9);
            }
         }
      } else {
         var2.a((int)0);
         var2.b(0);
         var2.c(0);
         CellArea var6 = new CellArea();
         com.aspose.cells.b.a.a.ze.a(var2.b(), (Object)var6);
      }

   }

   void a(znb var1) {
      byte var2 = 0;
      byte var3 = 0;
      int var13;
      int var14;
      if (this.a != null) {
         PaneCollection var4 = var1.c();
         switch(c.a(this.a.a.toLowerCase())) {
         case 4:
         case 5:
            var1.o(true);
         default:
            var4.a(a(this.a.e));
            if (this.a.d != null) {
               int[] var5 = new int[]{var2};
               int[] var6 = new int[]{var3};
               CellsHelper.a(this.a.d, var5, var6);
               var13 = var5[0];
               var14 = var6[0];
               var4.a(var13);
               var4.b(var14);
            }

            var4.d((int)this.a.b);
            var4.c((int)this.a.c);
         }
      }

      if (this.b != null) {
         zbcj var15 = new zbcj(var1.a);
         var1.i = var15;

         for(int var16 = 0; var16 < this.b.size(); ++var16) {
            zqj var17 = (zqj)this.b.get(var16);
            zbci var7 = new zbci(a(var17.a) & 255);
            com.aspose.cells.b.a.a.ze.a(var15, (Object)var7);
            String var8 = var17.d;
            if (var8 != null && var8.length() > 0) {
               var14 = 0;
               var13 = 0;
               if (var17.b != null) {
                  int[] var18 = new int[]{var13};
                  int[] var10 = new int[]{var14};
                  CellsHelper.a(var17.b, var18, var10);
                  var13 = var18[0];
                  var14 = var10[0];
               }

               var7.a(var13);
               var7.b(var14);
               var7.c(var17.c);
               String[] var19 = com.aspose.cells.b.a.zv.d(var8, ' ');

               for(int var20 = 0; var20 < var19.length; ++var20) {
                  String var11 = var19[var20].trim();
                  if (var11.length() > 0) {
                     CellArea var12 = (CellArea)CellArea.a(var11, true);
                     com.aspose.cells.b.a.a.ze.a(var7.b(), (Object)var12);
                  }
               }
            } else {
               var7.a((int)0);
               var7.b(0);
               var7.c(0);
               CellArea var9 = new CellArea();
               com.aspose.cells.b.a.a.ze.a(var7.b(), (Object)var9);
            }

            if (var7.a() == 3) {
               var1.p = (CellArea)var7.b().get(0);
            }
         }
      }

   }

   static zqh b(Worksheet var0) {
      zqh var1 = new zqh();
      if (var0.getPanes() != null) {
         PaneCollection var2 = var0.b();
         zqi var3 = new zqi();
         var1.a = var3;
         var3.e = a(var2.a());
         var3.a = var0.h() ? "frozen" : "split";
         if (!var2.a) {
            var3.d = CellsHelper.cellIndexToName(var2.b(), var2.c());
         }

         var3.b = (double)var2.e();
         var3.c = (double)var2.d();
      }

      if (var0.s() != null && var0.s().size() != 0) {
         var1.b = new ArrayList();

         for(int var5 = 0; var5 < var0.s().size(); ++var5) {
            zbci var6 = (zbci)((zbci)var0.s().get(var5));
            zqj var4 = new zqj();
            com.aspose.cells.b.a.a.ze.a(var1.b, (Object)var4);
            var4.b = CellsHelper.cellIndexToName(var6.c(), var6.d());
            var4.c = var6.e();
            var4.d = zase.b(var6.b(), 0, var6.b().size());
            var4.a = a(var6.a());
         }
      }

      return var1;
   }

   static zqh b(znb var0) {
      zqh var1 = new zqh();
      if (var0.h != null && var0.i != null && var0.i.size() > 1) {
         PaneCollection var2 = var0.h;
         zqi var3 = new zqi();
         var1.a = var3;
         var3.e = a(var2.a());
         var3.a = var0.y() ? "frozen" : "split";
         var3.d = CellsHelper.cellIndexToName(var2.b(), var2.c());
         var3.b = (double)var2.e();
         var3.c = (double)var2.d();
      }

      if (var0.i != null && var0.i.size() != 0) {
         var1.b = new ArrayList();

         for(int var5 = 0; var5 < var0.i.size(); ++var5) {
            zbci var6 = (zbci)((zbci)var0.i.get(var5));
            zqj var4 = new zqj();
            com.aspose.cells.b.a.a.ze.a(var1.b, (Object)var4);
            var4.b = CellsHelper.cellIndexToName(var6.c(), var6.d());
            var4.c = var6.e();
            var4.d = zase.b(var6.b(), 0, var6.b().size());
            var4.a = a(var6.a());
         }
      }

      return var1;
   }
}
